import wx

class Example(wx.Frame):
    def __init__(self, *args, **kwargs):
        super(Example, self).__init__(*args, **kwargs)
        self.InitUI()
    def InitUI(self):
        menubar = wx.MenuBar()

        fileMenu = wx.Menu()
        fileMenu.Append(wx.ID_NEW, "&New", kind=wx.ITEM_CHECK)
        fileMenu.Append(wx.ID_OPEN, "&Open")
        fileMenu.Append(wx.ID_SAVE, "&Save")
        fileMenu.AppendSeparator()

        imp = wx.Menu()
        imp.Append(wx.ID_ANY, "Import url")
        imp.Append(wx.ID_ANY, "Import file")
        imp.Append(wx.ID_ANY, "Import mail")

        fileMenu.AppendMenu(wx.ID_ANY, 'I&mport', imp)

        menubar.Append(fileMenu, '&File')
        self.SetMenuBar(menubar)

    def OnQuit(self, e):
        self.Close()
def main():
    app = wx.App()
    frame = Example(None, title='子菜单演示')
    frame.Show()
    app.MainLoop()

if __name__ == '__main__':
    main()
